
export default {
    // functional: true,

    props: {
        title: String
    },

    render: function (createElement) {
        // 插槽
        let $slots = this.$slots;

        // 顶部VNode
        let top = (this.title || $slots.actions)
            ? createElement('div', { class: 'card-top' }, [
                // 左侧
                createElement('div', { class: 'card-left' },
                    $slots.title || [createElement('h1', { class: 'card-title' }, this.title)]),
                // 右侧
                createElement('div', { class: 'card-right' }, $slots.actions)
            ])
            : null;

        // 内容VNode
        let content = createElement('div', { class: 'card-content' }, $slots.default);

        // 底部VNode
        let bottom = ($slots['bottom-left'] || $slots['bottom-right'])
            ? createElement('div', { class: 'card-bottom' }, [
                createElement('div', { class: 'card-left' }, $slots['bottom-left']),
                createElement('div', { class: 'card-right' }, $slots['bottom-right']),
            ])
            : null


        return createElement('div', { class: 'card' }, [top, content, bottom]);
    }
}